<%@page import="org.asportoonline.entities.Prodotto"%>
<%
    if (session.getAttribute("userid") == null || !session.getAttribute("tipo_utente").toString().equals("1")) {
        session.invalidate();
        getServletContext().getRequestDispatcher("/MainController?q=index").forward(request, response);
    }

    Prodotto p = (Prodotto) request.getAttribute("prodotto");
%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib uri="/WEB-INF/tlds/asportoonline.tld" prefix="asportoonline" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <title>AsportoOnline | Modifica prodotto</title>
        <style type="text/css">
            @import url("style.css");
        </style>
    </head>
    <body>
        <div class="meister">
            <div class="page">
                <div class="container">
                    <%@ include file="/WEB-INF/common/header.jsp"%>
                    <div class="navigation"> <a id="first" href="MainController?q=index">Home</a> > <a href="MainController?q=fetch_restaurants_data_action&amp;ret=list_restaurants">I miei locali</a> > <a href="#" onclick="history.back();">Dettagli locale</a> > Modifica prodotto </div>
                    
                    <div class="uniform_background">
                        <div class="center">        
                            <h1>Modifica prodotto</h1>

                            <form class="smallform" method="POST" action="MainController?q=modify_product_action">
                                <input type="hidden" name="idprodotto" value="<%=p.getIdProdotto()%>" /><br />
                                <fieldset><legend><em>Dati del prodotto</em></legend>
                                    <label>Nome<br /><input name="nome" value="<%=p.getNome()%>" /></label><br />
                                    <label>Categoria</label><br />
                                    <label><select name="categoria"><asportoonline:elenco_categorie categoria="<%=p.getCategoria().getNome()%>" lista_categorie="${lista_categorie}"/></select></label><br />
                                    <label>Descrizione<br /><input name="descrizione" value="<%=p.getDescrizione()%>" /></label><br />
                                    <label>Prezzo<br /><input id="prezzo" name="prezzo" value="<%=p.getPrezzo()%>" /> &euro;</label><br />
                                    <label>Immagine<br /><input name="urlimmagine" value="<%=p.getUrlimmagine()%>" /></label><br />
                                    <br /><p class="error">${error}</p><br />
                                    <input type="submit" value="MODIFICA" />
                                </fieldset>
                            </form>
                            <br />
                        </div>
                    </div>

                    <%@ include file="/WEB-INF/common/footer.jsp"%>
                </div>
            </div>
        </div>
    </body>
</html>
